﻿using System.Collections.Specialized;
using System.Web.Mvc;
using Xoohoo.Extensions;
using Xoohoo.Modules.Admin.Models;

namespace Xoohoo.Modules.Admin.ModelBinders
{
    public class UserProfileInputModelBinder : IModelBinder
    {
        public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            var valueProvider = bindingContext.ValueProvider;

            //string username = valueProvider.GetAttemptedValue("username");
            string displayName = valueProvider.GetAttemptedValue("displayName");
            string email = valueProvider.GetAttemptedValue("email");

            return new UserChangeProfileInput(/*username,*/ displayName, email);
        }
    }
}
